package com.lijin.converters;

import com.google.common.collect.Lists;
import java.util.List;
import java.util.stream.Collectors;
import org.springframework.core.convert.converter.Converter;
import org.springframework.util.CollectionUtils;

public interface EntityToDtoConverter<S, T> extends Converter<S, T> {

    default List<T> converters(List<S> list) {

        if (!CollectionUtils.isEmpty(list)) {
            return list.stream().map(this:: convert).collect(Collectors.toList());
        }

        return Lists.newArrayListWithCapacity(0);
    }
    
}
